package com.lianrui.app.comments.dao;

import java.util.List;

import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import com.lianrui.app.comments.domain.Comments;
import com.lianrui.app.comments.vos.CommentsPage;
import com.lianrui.core.IDao;

/**
 * @author Martin.lin
 * 
 * @version 1.0
 * 
 * @since 2016.1.6
 *
 */
@Repository
public interface ICommentsDao extends IDao<CommentsPage, Comments, Integer> {

	@Select("SELECT count(*)  from es_comments  where object_id in "
			+ "(select item_id from es_order_items where goods_id=#{orderId}) and commenttype='goods' "
			+ "and object_type='discuss' and display ='true'")
	public int getCommentCount(Integer orderId);
	
	@ResultMap("commentsEntity")
	@Select("select * from es_comments where for_comment_id = #{comments_id}")
	public List<Comments> getAppends(Integer comments_id);
	
}
